package com.demo1.factorys;

import com.demo1.entity.Person;
import com.demo1.test.Test;

import java.io.InputStream;
import java.util.Properties;

public class PersonFactory {
    public static Person makePerson(){
        Properties properties = new Properties();
        InputStream inputStream= Test.class.getResourceAsStream("../test/person.properties");
        Person person =null;
        try {
            properties.load(inputStream);
            String str = properties.getProperty("person");
            person = (Person) Class.forName(str).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return person;
    }
}
